import re

print("请输入MAC地址，回车结束输入")
L = []
while True:
    mac = input("please input the mac address: ")
    if mac == "":
        break
        print("正在整理中，请稍等......")
    L.append(mac)
print(L)
print("正确的MAC地址有这些")
for i in range(len(L)):
    m = re.match('^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$', L[i])
    if m is not None:
        s = m.group()
        print(s)
        f = open('/opt/mac.txt', 'a')
        f.write(f"{s}\n")
        f.close()
